/*
* FaceCat图形通讯框架
* 著作权编号:2015SR229355+2020SR0266727
* 上海卷卷猫信息技术有限公司
*/

#include "stdafx.h"
#include "FCDraw.h"

static String m_systemFont;

MyColor::MyColor(){
    m_lastStyle = -1;
}

MyColor::~MyColor(){
}

void MyColor::setSystemFont(String value){
    m_systemFont = value;
    FCNative::addChangeID();
}

String MyColor::getSystemFont(){
    if ((int)m_systemFont.length() == 0)
    {
        m_systemFont = L"Heiti SC";
    }
    return m_systemFont;
}

static int m_style = 1;

int MyColor::getStyle(){
    return m_style;
}
void MyColor::setStyle(int value){
    m_style = value;
}

void MyColor::createColors(){
    m_userColors.clear();
    if (m_style == 1)
    {
        m_userColors.put(FCColor_Back, FCColor::rgb(255, 255, 255)); //1
        m_userColors.put(FCColor_Border, FCColor::rgb(200, 200, 200)); //1
        m_userColors.put(FCColor_Text, FCColor::rgb(0, 0, 0)); //1
        m_userColors.put(FCColor_DisabledBack, FCColor::rgba(0, 0, 0, 25)); //1
        m_userColors.put(FCColor_DisabledText, 3289650);
        m_userColors.put(FCColor_Hovered, FCColor::rgba(43, 138, 195, 150));
        m_userColors.put(FCColor_Pushed, FCColor::rgba(43, 138, 195, 100));
    }
    else{
        m_userColors.put(FCColor_Back, (Long)1709331);
        m_userColors.put(FCColor_Border, (Long)3289650);
        m_userColors.put(FCColor_Text, (Long)16777215);
        m_userColors.put(FCColor_DisabledBack, (Long)-16777215025);
        m_userColors.put(FCColor_DisabledText, (Long)3289650);
        m_userColors.put(FCColor_Hovered, (Long)-12814891150);
        m_userColors.put(FCColor_Pushed, (Long)-12814891100);
    }
}

static Long m_hoverdColor = FCColor_None;

Long MyColor::getUserColor(Long color){
    if (m_lastStyle != m_style)
    {
        m_lastStyle = m_style;
       createColors();
    }
    m_userColors.tryget(color, &color);
    return color;
}

